{
    interface PayInterface{
        handle(price: number): void
    }
    
    class AliPay implements PayInterface{
        public handle(price: number): void{
            console.log(`支付宝支付${price}元`);
        }
    }
    
    class WeiPay implements PayInterface{
        public handle(price: number): void{
            console.log(`微信支付${price}元`);
        }
    }
    
    function payfun(type: string, price: number): void{
        let pay:PayInterface;
        switch(type){
            case "alipay":
                pay = new AliPay();
                break;
            case "weipay":
                pay = new WeiPay();
                break;
            default:
                break;
        }
        pay.handle(price);
    }
}